mkdir -p ./mypackage/debian
cd ./mypackage
 
# 创建源代码目录结构
mkdir -p src
echo "int main() { return 0; }" > src/main.c
 
# 创建 debian/changelog 和 debian/control 文件
cat > debian/control <<EOF
Source: mypackage
Section: misc
Priority: optional
Maintainer: Your Name <youremail@example.com>
Build-Depends: debhelper (>= 9), gcc
Standards-Version: 3.9.5
 
Package: mypackage
Architecture: any
Depends: \${shlibs:Depends}, \${misc:Depends}
Description: My Sample Package
 MyPackage is a sample program.
EOF
 
# 创建 debian/rules 文件
cat > debian/rules <<EOF
#!/usr/bin/make -f
 
export DH_VERBOSE=1
 
%:
    dh \$@
 
override_dh_auto_configure:
    dh_auto_configure -- \
        CC=gcc \
        CFLAGS=-g -O2
 
override_dh_auto_build:
    gcc -o mypackage src/main.c
EOF
chmod +x debian/rules
 
# 构建源码包
debuild -us -uc